package com.itheima.health.dao;


import com.itheima.health.dto.OrderSubmitParam;
import com.itheima.health.pojo.OrderSetting;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDate;
import java.util.Date;
import java.util.List;


@Mapper
public interface OrderSettingDao {
    /*
     *套餐项-查询
     * */
    @Select("select * from t_ordersetting where orderDate <= #{end} and orderDate >= #{begin}")
    List<OrderSetting> findPages(LocalDate begin, LocalDate end);
    /*
     * 设置预约人数
     * */
    void add(OrderSetting orderSetting);

    /**
     * 根据日期查询
     * @return
     */
    @Select("select * from t_ordersetting where orderDate = #{orderDate}")
    OrderSetting getByDate(OrderSetting orderSetting);

    /**
     * 根据日期修改
     * @param orderSetting
     */
    @Update("update t_ordersetting set number = #{number} where orderDate = #{orderDate}")
    void editByDate(OrderSetting orderSetting);

    @Update("update t_ordersetting set reservations=reservations+1 where orderDate=#{orderDate}")
    void update(OrderSubmitParam orderSubmitParam);

}
